package cn.dt.ymcc;

import cn.dt.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseFeignClientFallbackFactory implements FallbackFactory<CourseFeignClient> {
    @Override
    public CourseFeignClient create(Throwable throwable) {
        return new CourseFeignClient() {
            @Override
            public JSONResult getUserlearnByCourseIdAndLoginId(Long courseId, Long loginId) {
                throwable.printStackTrace();
                return JSONResult.error("课程服务不可达，请重新检查");
            }

            @Override
            public JSONResult getOrderInfo(String courseIds) {
                throwable.printStackTrace();
                return JSONResult.error("课程服务不可达，请重新检查");
            }
        };
    }
}
